package com.cxyjy.common.util;

import com.cxyjy.common.BusinessException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import static com.cxyjy.common.util.ResultUtil.error;

/**
 * 处理业务异常
 * @Author: jony
 * @Date : 2025/6/20 09:40
 * @VERSION v1.0
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(BusinessException.class)
    public JResponse<?> handleBusinessException(BusinessException be){
        return error(be.getResultCode());
    }
}
